import type { RouteRecordRaw } from 'vue-router'
import Hi from '@/pages/hi.vue'
import NoAuthPage from '@/pages/NoAuthPage.vue'
import ACCESS_ENUM from "@/access/accessEnum.ts";
import AdminPage from "@/pages/AdminPage.vue";
import UserLoginPage from "@/pages/user/UserLoginPage.vue";
import UserRegisterPage from "@/pages/user/UserRegisterPage.vue";
import UserLayout from "@/layouts/UserLayout.vue";
import Hello from "@/pages/hello.vue";

export const routes: Array<RouteRecordRaw> = [
  {
    path: '/user',
    name: '用户',
    component: UserLayout,
    children: [
      {
        path: '/user/login',
        name: '登录',
        component: UserLoginPage
      },
      {
        path: '/user/register',
        name: '注册',
        component: UserRegisterPage
      }
    ],
    meta: {
      hideinmenu: true
    }
  },
  {
    path: '/',
    name: '主页',
    component: Hi
  },
  {
    path: '/test',
    name: 'test',
    component: Hello
  },
  {
    path: '/noAuth',
    name: '无权限',
    component: NoAuthPage,
    meta: {
      hideinmenu: true
    }
  },
  {
    path: '/admin',
    name: '管理员可见',
    component: AdminPage,
    meta: {
      access: ACCESS_ENUM.ADMIN
    }
  },
  {
    path: '/admin2',
    name: '管理员可见2',
    component: AdminPage,
    meta: {
      access: ACCESS_ENUM.ADMIN
    }
  },
  {
    path: '/about',
    name: '关于我的',
    meta: {
      access: ACCESS_ENUM.USER
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../pages/hello.vue')
  }
]
